raar.process
Class RAProcess

java.lang.Object
  extended byraar.process.RAProcess
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
RAActor, RAExternalProcess, RASensor, RASpecialProcess

public class RAProcess
extends java.lang.Object
implements java.io.Serializable

RAProcess models a process in the RA environment. Process has:

A process is usually constructed by the RACompiler which interprets and compiles the RAAR code to these four components. Processes are chained using the RAAgent class.

See Also:
Serialized Form

Field Summary
protected  boolean hasRun
           
protected  RASetRegister inregister
           
protected  RAFetchRegister outregister
           
protected  RARegister register
           
protected  java.lang.String sourceCode
           
protected  RAStatement statement
           
 
Constructor Summary
RAProcess(RARegister register, RAStatement statement, RASetRegister inregister, RAFetchRegister outregister)
          Construct an RAProcess with register, statement(set), input and output.
 
Method Summary
 boolean acceptsInput(RADataType obj, java.lang.String name)
          Returns true if the process would accept the specified input object and name.
 java.lang.Object clone()
          Clone the process.
 void dumpRegisters()
          Give a System.out dump of the current content of all the registers (input, output, and internal).
 void execute()
          Executes the statement(set) in this process without updating the register and outputs first resp. afterwards!
 RADataType get(java.lang.String key)
          Get a specific key's value from the output register.
 RADataType getDataType(java.lang.String name)
          Returns the datatype for a given name.
 java.util.Vector getInputNames()
          Get a String vector containing the names of the keys the input register stores (in order).
 java.util.Vector getInputObjects()
          Get an RADataType vector containing the current content of the input register.
 java.util.Vector getOutputNames()
          Get a String vector containing the names of the keys the output register stores (in order).
 java.util.Vector getOutputObjects()
          Get an RADataType vector containing the current content of the output register.
 java.lang.String getProcessName()
          Get the process name.
 java.lang.String getSourceCode()
          Get the process source code.
 boolean isSpecial()
          Use this method to determine whether this process is a special one that should be executed before other processes (i.e. processes with this value on true will ALL be executed before processes with this value on false, and their outputs will be sent to connected inputs, also before the processes with this flag on false start).
 void reset()
          Reset process by physically erasing the data in the registers.
 void run()
          Run the process; first set all outputs to null.
 void set(java.lang.String key, RADataType value)
          Set a specific key in the input register to a specific value.
 void setProcessName(java.lang.String name)
          Set the process name.
 void setSourceCode(java.lang.String code)
          Set the process source code; subclasses may throw the exception.
 boolean suppliesOutput(RADataType obj, java.lang.String name)
          Returns true if the process can supply the specified output object and name.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sourceCode

protected java.lang.String sourceCode

statement

protected RAStatement statement

register

protected RARegister register

inregister

protected RASetRegister inregister

outregister

protected RAFetchRegister outregister

hasRun

protected boolean hasRun
Constructor Detail

RAProcess

public RAProcess(RARegister register,
                 RAStatement statement,
                 RASetRegister inregister,
                 RAFetchRegister outregister)
Construct an RAProcess with register, statement(set), input and output.

Method Detail

reset

public void reset()
           throws RAException
Reset process by physically erasing the data in the registers.

Throws:
RAException

setProcessName

public void setProcessName(java.lang.String name)
Set the process name.


getProcessName

public java.lang.String getProcessName()
Get the process name.


setSourceCode

public void setSourceCode(java.lang.String code)
                   throws RAException
Set the process source code; subclasses may throw the exception.

Throws:
RAException

getSourceCode

public java.lang.String getSourceCode()
Get the process source code.


execute

public void execute()
             throws RAException
Executes the statement(set) in this process without updating the register and outputs first resp. afterwards!

Throws:
RAException

run

public void run()
         throws RAException
Run the process; first set all outputs to null. Then copy the inputs from the input register to the internal register, execute the process, and copy outputs to the output register. Then set all inputs to null as well.

Throws:
RAException

dumpRegisters

public void dumpRegisters()
Give a System.out dump of the current content of all the registers (input, output, and internal).


set

public void set(java.lang.String key,
                RADataType value)
         throws RAException
Set a specific key in the input register to a specific value.

Throws:
RAException

get

public RADataType get(java.lang.String key)
               throws RAException
Get a specific key's value from the output register.

Throws:
RAException

getInputNames

public java.util.Vector getInputNames()
Get a String vector containing the names of the keys the input register stores (in order). This shows a user which inputs a process has (by name).


getInputObjects

public java.util.Vector getInputObjects()
Get an RADataType vector containing the current content of the input register. Rather than manipulating this content in a sneaky way now, you should use this feature to determine the datatypes of the content. This enables checking whether certain connections are allowed between (various) processes' out- and input.


getOutputNames

public java.util.Vector getOutputNames()
Get a String vector containing the names of the keys the output register stores (in order). This shows a user which outputs a process has (by name).


getOutputObjects

public java.util.Vector getOutputObjects()
Get an RADataType vector containing the current content of the output register. Rather than manipulating this content in a sneaky way now, you should use this feature to determine the datatypes of the content. This enables checking whether certain connections are allowed between (various) processes' out- and input.


acceptsInput

public boolean acceptsInput(RADataType obj,
                            java.lang.String name)
Returns true if the process would accept the specified input object and name.


suppliesOutput

public boolean suppliesOutput(RADataType obj,
                              java.lang.String name)
Returns true if the process can supply the specified output object and name.


getDataType

public RADataType getDataType(java.lang.String name)
                       throws RAException
Returns the datatype for a given name. Necessary for making healthy connections.

Throws:
RAException

isSpecial

public boolean isSpecial()
Use this method to determine whether this process is a special one that should be executed before other processes (i.e. processes with this value on true will ALL be executed before processes with this value on false, and their outputs will be sent to connected inputs, also before the processes with this flag on false start). This is particularly useful for SUPPRESS and INHIBIT.

This process class is a regular one that therefore will return false.


clone

public java.lang.Object clone()
Clone the process.